package top.yueyazhui.account.controller;

import io.seata.rm.tcc.api.BusinessActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import top.yueyazhui.account.service.AccountService;
import top.yueyazhui.common.feign.AccountFeign;

@RestController
public class AccountController implements AccountFeign {

    @Autowired
    AccountService accountService;

    @Override
    public boolean prepare(BusinessActionContext businessActionContext, String userId, Double money) {
        return accountService.prepare(userId, money);
    }

    @Override
    public boolean commit(BusinessActionContext businessActionContext) {
        return accountService.commit(businessActionContext);
    }

    @Override
    public boolean rollback(BusinessActionContext businessActionContext) {
        return accountService.rollback(businessActionContext);
    }
}
